<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- React核心包 最先引入  提供一个对象React -->
  <script src="../../react资料_stu/依赖包/react.development.js"></script>
  <!-- ReactDOM包  提供一个对象ReactDOM -->
  <script src="../../react资料_stu/依赖包/react-dom.development.js"></script>
  <!-- babel -->
  <script src="../../react资料_stu/依赖包/babel.min.js"></script>
</head>

<body>
  <!-- react操作的容器 -->
  <div id="app">

  </div>
</body>
<script type="text/babel">

  class Fu extends React.Component {

    state = {
      isHot: true,
      car: "八手奥托"
    }

    render() {
      const { car } = this.state

      return (<div>
        <p>我是父组件</p>
        <p a={1}>我开的是{car}</p>
        <hr/>
        <Son car={car} />
      </div>)

    }

  }
  
  class Son extends React.Component{

    render() {
      //这是子组件实列
      console.log(this);
      //这是从父组件拿的数据
      console.log(this.props);
      const {car} = this.props
      return (<div>
        <p>我是子组件</p>
        <p>我开我老子的{car}</p>
      </div>)

    }
  }



  //创建容器并渲染虚拟DOM

  const root = ReactDOM.createRoot(document.getElementById('app'));
  root.render(<Fu />)



</script>

</html>